Page({
  data: {
    inputtext1:'',
    inputtext2:'',
    inputtext0:'',
    //一、	所需证件及材料
    tip1text: [],
    //二、	办理流程
    tip2text: [],
  },
  onLoad: function (option) {
  },
  //类型名称
  text0:function(e){
     this.setData({
       inputtext0:e.detail.value
     })
  },
  //	所需证件及材料
  text1: function (e) {
    this.setData({
      inputtext1: e.detail.value
    })
  },
  addtext1: function () {
    var that  =this;
    that.setData({
      tip1text: that.data.tip1text.concat(this.data.inputtext1),
      inputtext1:'',
    })
  },
  //流程
  text2: function (e) {
    this.setData({
      inputtext2: e.detail.value
    })
  },
  addtext2: function () {
    var that = this;
    that.setData({
      tip2text: that.data.tip2text.concat(this.data.inputtext2),
      inputtext2:'',
    })
  },
  //添加办理类型
  tosumbit: function () {
    var that = this;
    //信息无误，进行提交
    const db = wx.cloud.database()//打开数据库连接
    db.collection("bookingtype").add({
      data: {
        type:that.data.inputtext0,
        material: that.data.tip1text,
        process: that.data.tip2text,
       
      }, success: res => {
        wx.showToast({
          title: '添加成功',
        })
        wx.switchTab({
          url: '../index/index',
        })
      }, fail: err => {
        wx.showToast({
          title: '添加失败，请重试',
        })
      }
    })
  },

})